package com.huawei.hwid.core.b.a.a;

import android.content.Context;
import android.os.Bundle;
import android.text.TextUtils;
import com.huawei.cloudservice.CloudRequestHandler;
import com.huawei.hms.framework.common.ContainerUtils;
import com.huawei.hwid.core.b.a.a.c;
import com.huawei.hwid.core.b.a.e;
import com.huawei.hwid.core.constants.HwAccountConstants;
import com.huawei.hwid.core.d.b;
import com.huawei.hwid.core.helper.handler.ErrorStatus;
import com.huawei.hwid.f.g;
import java.io.IOException;
import java.util.HashMap;
import org.xmlpull.v1.XmlPullParserException;

public class i extends com.huawei.hwid.core.b.a.a {
    private String h = HwAccountConstants.TYPE_TENCENT;
    private String i;
    private String j;
    private String k;
    private String l = "/IUserPwdMng/verifyPassword";
    private String m = this.l;
    private Context n;

    static class a extends com.huawei.hwid.core.helper.handler.a {
        private CloudRequestHandler a;

        public a(Context context, CloudRequestHandler cloudRequestHandler) {
            super(context);
            this.a = cloudRequestHandler;
        }

        public void a(Bundle bundle) {
            super.a(bundle);
            this.a.onFinish(bundle);
        }

        public void b(Bundle bundle) {
            super.b(bundle);
            ErrorStatus errorStatus = (ErrorStatus) bundle.getParcelable("requestError");
            if (errorStatus != null) {
                this.a.onError(errorStatus);
            } else {
                this.a.onError(new ErrorStatus(32, "ErrorStatus is null"));
            }
        }
    }

    public i() {
        a(c.b);
    }

    public i(Context context, String str, String str2, String str3, String str4) {
        a(c.b);
        f(str2);
        g(str);
        h(str3);
        i(str4);
        b(70002003);
    }

    public String k() {
        StringBuffer stringBuffer = new StringBuffer();
        stringBuffer.append("ver=").append("27120").append(ContainerUtils.FIELD_DELIMITER).append("acT=").append(this.k).append(ContainerUtils.FIELD_DELIMITER).append("ac=").append(this.i).append(ContainerUtils.FIELD_DELIMITER).append("pw=").append(this.j).append(ContainerUtils.FIELD_DELIMITER).append("clT=").append(this.h).append("&lang=").append(c(this.n));
        return stringBuffer.toString();
    }

    public void b(String str) {
        if (!TextUtils.isEmpty(str)) {
            String[] split = str.split(ContainerUtils.FIELD_DELIMITER);
            HashMap hashMap = new HashMap();
            Object obj = "";
            for (String split2 : split) {
                String[] split3 = split2.split(ContainerUtils.KEY_VALUE_DELIMITER);
                hashMap.put(split3[0], split3[1]);
                obj = split3[0];
            }
            if (hashMap.containsKey("resultCode")) {
                this.b = g.a((String) hashMap.get("resultCode"));
            }
            if (this.b != 0) {
                this.c = this.b;
                this.d = (String) hashMap.get(obj);
            }
        }
    }

    private void f(String str) {
        this.j = str;
    }

    private void g(String str) {
        this.i = str;
    }

    private void h(String str) {
        this.k = str;
    }

    private void i(String str) {
        this.h = str;
    }

    public String j() throws IllegalArgumentException, IllegalStateException, IOException {
        return null;
    }

    public void a(String str) throws XmlPullParserException, IOException {
    }

    public String b() {
        return this.m;
    }

    public String c(Context context) {
        return b.f(context);
    }

    public void a(Context context, com.huawei.hwid.core.b.a.a aVar, String str, CloudRequestHandler cloudRequestHandler) {
        e.a(context, aVar, str, a(context, aVar, new a(context, cloudRequestHandler)));
    }
}
